<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Crear Tarjeta de Credito"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form id="frm">
                <h:panelGrid columns="2">
                    <h:outputLabel value="" for="creditcardid" />
                    <h:inputHidden id="creditcardid" value="0"  />
                    
                    <h:outputLabel value="Tipo de Tarjeta" for="creditcardtype" />
                    <h:selectOneMenu id="creditcardtype" value="#{creditcardController.selected.creditcardtype}" title="Tipo de Tarjeta" >
                        <f:selectItems value="#{creditcardController.creditCardsAvaliable}"/>
                    </h:selectOneMenu>
                    
                       
                    <h:outputLabel value="Numero de Tarjeta" for="creditcardnumber" />
                    <h:inputText id="creditcardnumber" value="#{creditcardController.selected.creditcardnumber}" title="Numero" required="true" requiredMessage="Ingrese el Numero de Tarjeta"/>
                    
                    <h:outputLabel value="Mes de Expiracion" for="creditcardexpirationmonth" />
                    <h:inputText id="creditcardexpirationmonth" value="#{creditcardController.selected.creditcardexpirationmonth}" title="Mes de Expiracion" required="true" requiredMessage="Ingrese el Mes de Expitacion"/>
                    
                    <h:outputLabel value="Anno de Expiracion" for="creditcardexpirationyear" />
                    <h:inputText id="creditcardexpirationyear" value="#{creditcardController.selected.creditcardexpirationyear}" title="Anno de Expiracion" required="true" requiredMessage="Ingrese el Anno de Expiracion"/>
                    
                    <h:outputLabel value="Numero de Verificacion" for="creditcardverificationnumber" />
                    <h:inputText id="creditcardverificationnumber" value="#{creditcardController.selected.creditcardverificationnumber}" title="Numero de Verificacion" />
                         
                    <h:outputLabel value="Almacenar el Numero de Tarjeta?" for="savecreditcardnumber" />
                    <h:selectOneMenu id="savecreditcardnumber" value="#{creditcardController.selected.savecreditcardnumber}" title="Almacenar el Numero de Tarjeta" >
                        <f:selectItems value="#{creditcardController.yesNo}"/>
                    </h:selectOneMenu>
                    
                    
                    <h:outputLabel value="" for="customerid" />
                    <h:inputHidden id="customerid" value="#{customerController.selected.customerid}" ></h:inputHidden>
                    
                    <h:outputLabel value="" for="customerid2" />
                    <h:inputHidden id="customerid2" value="#{creditcardController.selected.customerid}"></h:inputHidden>
                    
                </h:panelGrid>
                <br />
                <h:commandLink action="#{creditcardController.create}" value="Crear" />
                <br />
                <br />
                <h:commandLink action="#{creditcardController.customer}" value="Volver al Cliente" immediate="true"/>
                <br />
                <br />
                  <script>
                     document.getElementById('frm:customerid2').value = document.getElementById('frm:customerid').value;
                  </script>
            </h:form>
        </ui:define>
    </ui:composition>
    
   

</html>
